from selenium import webdriver  
from selenium.webdriver.chrome.service import Service  
from webdriver_manager.chrome import ChromeDriverManager  
import time
def login():
    # 设置ChromeDriver的路径（使用webdriver_manager自动管理驱动程序）  
    service = Service(ChromeDriverManager().install())  
    
    # 创建Chrome浏览器实例  
    driver = webdriver.Chrome(service=service)  
    
    # 打开一个网页  
    driver.get("https://perfeye.console.testplus.cn/case/list")  

    result=driver.get_cookie("mysession")
    while not result or "value" not in result:
        time.sleep(1)
        result=driver.get_cookie("mysession")
    result=result["value"]
    print("登录成功！正在关闭浏览器...")
    # 关闭浏览器  
    driver.quit()
    return result